package com.seed.web.core;

import javax.servlet.http.HttpServletRequest;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

/**
 * <p>
 * Title：公共属性字段
 * </p>
 * <p>
 * Description：
 * </p>
 * 
 * @Author：杨浩泉
 * @Date：2010-4-28
 */
@Component
@Scope("prototype")
public class BaseForm {

	/** 公共HttpServletRequest */
	private HttpServletRequest request;

	/** 公共类型参数 */
	private String type;

	private String param ;

	public BaseForm() {}

	public BaseForm(HttpServletRequest request) {
		this.request = request;
	}
	

	/** 服务器绝对URl地址 */
	public String getBasePath() {

		return request.getScheme() + "://" + request.getServerName() + request.getContextPath();
	}

	public String getParam() {
		return param;
	}

	/** 相对路径，当前项目名称 */
	public String getPath() {
		return request.getContextPath();
	}

	/** 获得项目的绝对路径 */
	public String getRealPath() {
		return this.getRequest().getSession().getServletContext().getRealPath("/");
	}

	public HttpServletRequest getRequest() {
		return request;
	}

	public String getType() {
		return type;
	}

	public void setParam(String param) {
		this.param = param;
	}

	public void setRequest(HttpServletRequest request) {
		this.request = request;
	}

	public void setType(String type) {
		this.type = type;
	}

}